package com.zhuss.controller.product;

import com.zhuss.bean.bo.product.train.*;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.exception.DzcxException;
import com.zhuss.product.train.LineStrategyOperateServiceExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;


/**
 * @description: 线路策略操作的Controller
 * @author: zhushanshuo
 * @create: Mon Jan 04 09:51:07 CST 2021
 **/
@RestController
@RequestMapping("/lineStrategy")
public class LineStrategyOperateController extends BaseController {

	@Autowired
	@Qualifier("lineStrategyOperateService")
	private OperateService<Void, Object> lineStrategyOperateService;

	@Autowired
	@Qualifier("lineStrategyOperateServiceExt")
	private LineStrategyOperateServiceExt lineStrategyOperateServiceExt;

	/**
	 * 创建
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateLineStrategyBo bo) throws DzcxException {

		lineStrategyOperateService.create(bo);
    }


	/**
	 * 修改
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateLineStrategyBo bo) throws DzcxException {

		lineStrategyOperateService.update(bo);
    }

	/**
	 * 删除
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteLineStrategyBo bo) throws DzcxException {

		lineStrategyOperateService.delete(bo);
    }


	/**
	 * 编辑站点
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
	@PostMapping("/editSite")
	public void editSite(@RequestBody BindStrategySiteBo bo) throws DzcxException {
		lineStrategyOperateServiceExt.editSite(bo);
	}


	/**
	 * 停售，售卖
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
	@PostMapping("/sell")
	public void sell(@RequestBody BindStrategySiteBo bo) throws DzcxException {
		lineStrategyOperateServiceExt.sell(bo);
	}


}
